/**
 * 
 */
package com.thor.palmmall.rest.vkcommunicate.converter;

import org.springframework.core.convert.converter.Converter;

import com.thor.palmmall.rest.chart.converter.SDateRangeConverter;
import com.thor.palmmall.rest.vkcommunicate.AVKCommunicateQueryParam;
import com.thor.palmmall.spi.vkcommunicate.SVKCommunicateQueryParam;

/**
 * @author Captain
 *
 * @since 1.0
 */
public class SVKCommunicateQueryParamConverter
    implements Converter<AVKCommunicateQueryParam, SVKCommunicateQueryParam> {

  public static SVKCommunicateQueryParamConverter getInstance() {
    if (instance == null)
      instance = new SVKCommunicateQueryParamConverter();
    return instance;
  }

  private static SVKCommunicateQueryParamConverter instance;

  private SVKCommunicateQueryParamConverter() {
  }

  @Override
  public SVKCommunicateQueryParam convert(AVKCommunicateQueryParam source) {
    if (source == null) {
      return null;
    }
    SVKCommunicateQueryParam target = new SVKCommunicateQueryParam();
    target.setProject(source.getProject());
    target.setInvestActor(source.getInvestActor());
    target.setBrandName(source.getBrandName());
    target.setTenantName(source.getTenantName());

    target.setDateRange(SDateRangeConverter.getInstance().convert(source.getDateRange()));
    target.setOrder(source.getOrder());
    target.setPage(source.getPage());
    target.setPageSize(source.getPageSize());

    target.setKeyword(source.getKeyword());
    target.setDiscussTheme(source.getDiscussTheme());

    return target;
  }

}
